<?php

class Application_Model_Reservierung
{
	protected $_nr;
	protected $_benutzernr;
	protected $_parkplatznr;
	protected $_ticketnr;
	protected $_datumvon;
	protected $_datumbis;
	protected $_preis;
	///magic methoden anfang
public function __construct(array $options = null)
	{
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}

	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid article property');
		}
		$this->$method($value);
	}

	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid article property');
		}
		return $this->$method();
	}

	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
		///magic methoden ende
	
//nr ist autoincrement in mysql
	public function setNr($id)
	{
		$id = (int) $id;

		if ($id != 0) {
			$this->_nr = $id;
		}
	}

	public function getNr()
	{
		return $this->_nr;
	}
	
	
	public function setBenutzernr($id)
	{
		$id = (int) $id;

		if ($id != 0) {
			$this->_benutzernr = $id;
		}
	}

	public function getBenutzernr()
	{
		return $this->_benutzernr;
	}


	public function setParkplatznr($id)
	{
		$this->_parkplatznr = $id;
		
	}

	public function getParkplatznr()
	{
		return $this->_parkplatznr;
	}


	public function setTicketnr($id)
	{
		$this->_ticketnr = $id;
	}

	public function getTicketnr()
	{
		return $this->_ticketnr;
	}


	public function setDatumvon($datumvon)
	{
		//$datumvon = da;

		//if ($id != 0) {
			$this->_datumvon = $datumvon;
		//}
	}

	public function getDatumvon()
	{
		return $this->_datumvon;
	}
	
	
	public function setDatumbis($datumbis)
	{
		//$datumvon = da;

		//if ($id != 0) {
			$this->_datumbis = $datumbis;
		//}
	}

	public function getDatumbis()
	{
		return $this->_datumbis;
	}
	
	
	public function setPreis($preis)
	{

			$this->_preis = $preis;

	}

	public function getPreis()
	{
		return $this->_preis;
	}
}